package com.ruoyi.common.utils;

import lombok.Data;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * 转换以String类型存贮的时间变量的格式用
 *
 *
 */
public class DataFormUtils {
    public static String afterTrans (String beforeTrans){

        DateTimeFormatter dateTimeFormatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        DateTimeFormatter dateTimeFormatter2 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        LocalDateTime localDateTime = LocalDateTime.parse(beforeTrans.substring(0,19), dateTimeFormatter1);
        return localDateTime.toLocalDate().format(dateTimeFormatter2);
    }
}
